import http from '@/utils/request.js';
export const getSystem = () => {
	// return http.get('/maintain_job/plan_report');
	return http.request({
		url: '/maintain_job/plan_report',
		method: 'get',
	});
};
export const uploadFile = (file, imgId) => {
	return new Promise((resolve) => {
		if (!file) {
			resolve({
				data: {
					link: ''
				}
			});
			return;
		}
		http.upload(file, imgId).then(res => {
			resolve(res);
		}).catch(err => {
			resolve({
				data: {
					link: ''
				}
			});
		});
	});
};

// --------------------------------------------------------------
// 签到接口
// 获取签到页面数据
export const getSiginInfo = (data) => {
	// return http.get('/repair/user/sign/home/info', data);
	return http.request({
		url: '/repair/user/sign/home/info',
		method: 'get',
		data
	});
};
// 签到考勤明细
export const getSiginDetail = (data, status = true) => {
	// return http.get('/repair/user/sign/detail', data, status);
	return http.request({
		url: '/repair/user/sign/detail',
		method: 'get',
		data,
		toast: status
	});
};
// 签到保存
export const getSiginUpdate = (data) => {
	// return http.post('/repair/user/sign/update', data, true);
	return http.request({
		url: '/repair/user/sign/update',
		method: 'post',
		data,
		textJson: true,
	});
};

// 签到北京时间
export const bjOfTime = (data) => {
	// return http.get('/repair/user/sign/bjOfTime', data);
	return http.request({
		url: '/repair/user/sign/bjOfTime',
		method: 'get',
		data,
	});
};

// 签到补卡
export const siginMake = (data) => {
	// return http.post('/repair/user/sign/updateNewSign', data, true);
	return http.request({
		url: '/repair/user/sign/updateNewSign',
		method: 'post',
		data,
		textJson: true,
	});
};

// 新增水印记录
export const pushWatermark = (data) => {
	// return http.post('/maintain/watermark/img/save', data, true);
	return http.request({
		url: '/maintain/watermark/img/save',
		method: 'post',
		data,
		textJson: true,
	});
};

// 统一处理工单相关照片
export const updateWatermark = (data) => {
	// return http.post('/maintain/watermark/img/update/plan/img', data, true);
	return http.request({
		url: '/maintain/watermark/img/update/plan/img',
		method: 'post',
		data,
		textJson: true,
	});
};

// 获取服务器时间 
export const getDerviceTime = (data) => {
	// return http.get('/repair/maintain/plan/content/service/time', data, false, false);
	return http.request({
		url: '/repair/maintain/plan/content/service/time',
		method: 'get',
		data,
		toast: false,
		timeout: false,
	});
};

export const getStsToken = (data) => {
	// return http.get('/sts', data);
	return http.request({
		url: '/sts',
		method: 'get',
		data,
	});
};

// 获取图片审核信息
export const getImageInfo = (data) => {
	// return http.get('/repair/plan/image/history/detail', data, false, false);
	return http.request({
		url: '/repair/plan/image/history/detail',
		method: 'get',
		data,
		toast: false,
		timeout: false,
	});
};

// 编辑图片审核信息
export const setImageInfo = (data) => {
	// return http.put('/repair/plan/image/history/update/v2', data, false, false);
	return http.request({
		url: '/repair/plan/image/history/update/v2',
		method: 'put',
		data,
		toast: false,
	});
};

// 图片申诉
export const setImageAppeal = (data) => {
	// return http.put('/repair/plan/image/history/update/appeal', data, false, false);
	return http.request({
		url: '/repair/plan/image/history/update/appeal',
		method: 'put',
		data,
		toast: false,
		textJson: true,
	});
};

// 获取ai图片列表
export const getAIImages = (data) => {
	// return http.get('/repair/plan/image/history/list', data, false, false);
	return http.request({
		url: '/repair/plan/image/history/list',
		method: 'get',
		data,
		toast: false,
		timeout: false,
	});
};